package dao.concret;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import dao.AbstractTable;
import dao.DAO;
import dao.tables.OEUVRE;

public class OeuvreDAO extends DAO<OEUVRE> {

	@Override
	public OEUVRE find(long id) {
		OEUVRE oeuvre = new OEUVRE();
		try {
			Statement stmt = this.connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
				ResultSet.CONCUR_UPDATABLE);
			ResultSet result = stmt.executeQuery("SELECT * FROM OEUVRE WHERE IDOEUVRE = " + id);
			if (result.first()) {
				oeuvre.setId(id);
				oeuvre.setTitre(result.getString("TITREOEUVRE"));
			}
			result.close();
			stmt.close();
		} catch (SQLException sqle) {
			sqle.printStackTrace();
		}
		return oeuvre;
	}

	@Override
	public OEUVRE create(AbstractTable at) {
		OEUVRE obj = (OEUVRE) at;
		obj.getClass();
		return null;
	}

	@Override
	public OEUVRE update(AbstractTable at) {
		OEUVRE obj = (OEUVRE) at;
		obj.getClass();
		return null;
	}

	@Override
	public OEUVRE delete(AbstractTable at) {
		OEUVRE obj = (OEUVRE) at;
		obj.getClass();
		return null;
	}

	@Override
	public ArrayList<OEUVRE> list() {
		return null;
	}

}
